package com.eolcum.evocenter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

@Repository
public class ActionBuffer {
	
	private Map<String, List<Action>> actionMap = new HashMap<String, List<Action>>();

	public Map<String, List<Action>> getActionMap() {
		return actionMap;
	}

	public void setActionMap(Map<String, List<Action>> actionList) {
		this.actionMap = actionList;
	}
	
	public List<Action> getActionList(String evoId) {
		return actionMap.get(evoId);
	}
	
	public List<Action> getActions(String evoId, int actionCode) {
		List<Action> actionList = getActionList(evoId);
		List<Action> resultList = new ArrayList<Action>();
		for(int i = 0; i < actionList.size(); i++) {
			if(actionList.get(i).getAction() == actionCode) {
				resultList.add(actionList.get(i));
			}
		}
		return resultList;
	}
}
